import request from '@/assets/utils/request'
import type {AxiosPromise} from 'axios'

/**
 * 通过id获取分类数据
 * @param id 分类id
 * @return {AxiosPromise}
 */
export const getCategory = (id: string) => request.get('category', {id})

/**
 * 通过id获取子分类数据
 * @param id
 * @return {AxiosPromise}
 */
export const getSubCategory = (id: string) => request.get('category/sub/filter', {id})

/**
 * 通过筛选条件获取商品数据
 * @param filter 筛选条件
 */
export const getSubGoods = (filter: any) => request.post('category/goods/temporary', filter)